#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from ._base import ApiConfig, AdminConfig


class ProMixin(object):
    RUN_ENV = 'prod'

    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:Linlong219@47.98.106.87:3306/domain?charset=utf8mb4"
    SQLALCHEMY_BINDS = {
        'yhdd': 'mysql+pymysql://root:Linlong219@47.98.106.87:3306/domain?charset=utf8mb4'
    }

    # 连接池
    SQLALCHEMY_POOL_SIZE = 10
    SQLALCHEMY_POOL_TIMEOUT = 5
    # 连接池重连时间 6 小时
    SQLALCHEMY_POOL_RECYCLE = 6 * 3600

    SECRET_KEY = '8c71fb3f7593543f2ad180d31148a7cf'
    INFORMATION_COLUMN_ID = 22

    # redis
    REDIS_DB = 1
    REDIS_HOST = '172.30.170.20'
    REDIS_PORT = 6379
    # REDIS_PASSWORD = 'face_redis$%^'

    # celery 配置
    CELERY_BROKER_URL = 'redis://172.30.170.20:6379/5'


class ProApiConfig(ProMixin, ApiConfig):
    pass


class ProAdminConfig(ProMixin, AdminConfig):
    # 禁止CSRF攻击检验
    WTF_CSRF_ENABLED = False
